package com.scen.upload.controller;

import com.scen.upload.service.CustomerService;
import com.scen.upload.vo.AjaxResult;
import com.scen.upload.vo.DataEntity;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * echarts控制层
 */
@Log4j2
@RestController
@RequestMapping("system/echarts")
public class EchartsController {

    @Autowired
    private CustomerService customerService;

    /**
     * 构造省份客户数量对应数据串
     *
     * @return
     */
    @GetMapping("queryAddressOfCustomer")
    public AjaxResult queryAddressOfCustomer() {
        Map<String, Object> res = this.customerService.queryAddressOfCustomer();
        return AjaxResult.success(res);
    }

    /**
     * 查询饼状图所需数据
     *
     * @return
     */
    @GetMapping("queryCakeData")
    public AjaxResult queryCakeData() {
        List<DataEntity> res = this.customerService.queryCakeData();
        return AjaxResult.success(res);
    }
}
